package com.gt.aep.base.entity.util;

import java.text.SimpleDateFormat;
import java.util.Date;

public class DateTime {
    private String time;
    public DateTime(String pattern){
        SimpleDateFormat df = new SimpleDateFormat(pattern);//设置日期格式
        String dateTime=df.format(new Date());
        this.time=dateTime;
    }

    /**
     * yyyy-MM-dd HH:mm:ss 格式时间
     * @return
     */
    public  static String time() {
        String pattern = "yyyy-MM-dd HH:mm:ss";
        DateTime dateTime=new DateTime(pattern);
        return dateTime.time;
    }

    /**
     * yyyyMMddHHmmss 格式时间
     * @return
     */
    public  static String eassyTime() {
        String pattern = "yyyyMMddHHmmss";
        DateTime dateTime=new DateTime(pattern);
        return dateTime.time;
    }

}
